package com.example.blood_sugar.fragments;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.blood_sugar.R;
import com.example.blood_sugar.bean.BSRecord;
import com.github.mikephil.charting.charts.BarChart;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.data.BarData;
import com.github.mikephil.charting.data.BarDataSet;
import com.github.mikephil.charting.data.BarEntry;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.github.mikephil.charting.utils.ColorTemplate;

import java.util.ArrayList;
import java.util.List;

public class BloodSugarChartFragment7days_bak extends BaseFragment {

    private List<BSRecord> mBSRecords;

    public static BloodSugarChartFragment7days_bak newInstance(String text){
        Bundle bundle = new Bundle();
        bundle.putString("text",text);
        BloodSugarChartFragment7days_bak bloodSugarFragment7days = new BloodSugarChartFragment7days_bak();
        bloodSugarFragment7days.setArguments(bundle);
        return  bloodSugarFragment7days;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        final View view = inflater.inflate(R.layout.fragment_blood_sugar_chart_7days, container, false);

/*        mBSRecords = new ArrayList<>();
        LineChart lineChart = view.findViewById(R.id.chart);

        List<Entry> entries = new ArrayList<>();
        entries.add(new Entry(4f,0));
        entries.add(new Entry(8f,1));
        entries.add(new Entry(6f,2));
        entries.add(new Entry(12f,3));
        entries.add(new Entry(18f,4));
        entries.add(new Entry(9f,5));
        LineDataSet dataSet = new LineDataSet(entries,"# of Calls");
        dataSet.setColors(ColorTemplate.COLORFUL_COLORS);

//        List<String> labels = new ArrayList<>();
//        labels.add("January");
//        labels.add("February");
//        labels.add("March");
//        labels.add("April");
//        labels.add("May");
//        labels.add("June");

        LineData data = new LineData(dataSet);
        lineChart.setData(data);*/
//        barChart.setDescription("# of times Alice called Bob");
        return view;
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        // TODO: 2018/8/21 创建成功后初始化操作？
    }
}
